package net.wofly.sale.order.service.impl;

import java.util.List;

import javax.transaction.Transactional;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import net.wofly.sale.order.repository.GiftRepository;
import net.wofly.sale.order.domain.Gift;
import net.wofly.sale.order.service.IGiftService;

@Service("iGiftService")
@Transactional
public class GiftServiceImpl implements IGiftService {

	@Autowired
	GiftRepository giftRepository;

	@Override
	public Gift save(Gift entity) {
		return giftRepository.save(entity);
	}

	@Override
	public void delete(Gift entity) {
		giftRepository.delete(entity);
	}

	@Override
	public void delete(String key) {
		giftRepository.delete(key);
	}
	
	@Override
	public void deleteByOrderID(String orderID) {
		giftRepository.deleteByOrderID(orderID);
	}
	
	@Override
	public Gift findOne(String key) {
		return giftRepository.findOne(key);
	}

	@Override
	public List<Gift> save(List<Gift> entityList) {
		return (List<Gift>) giftRepository.save(entityList);
	}
	
	@Override
	public List<Gift> findByOrderID(String orderID) {
		return giftRepository.findByOrderID(orderID);
	}
}
